package com.yuandian.utils.poi.converter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;

/**
 * 说明：时长格式化converter
 * @Author yanjun
 * @Date 2021/1/28 17:16
 */
public class DurationFormatConverter  implements Converter<Object> {

    /**
     * java类型
     * @return
     */
    @Override
    public Class supportJavaTypeKey() {
        return Object.class;
    }

    /**
     * excel类型
     * @return
     */
    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return CellDataTypeEnum.STRING;
    }

    /**
     * 读时调用
     * @param cellData
     * @param contentProperty
     * @param globalConfiguration
     * @return
     * @throws Exception
     */
//    @Override
//    public Object convertToJavaData(CellData cellData, ExcelContentProperty contentProperty,
//                                    GlobalConfiguration globalConfiguration) throws Exception {
//        return null;
//    }
//
//    /**
//     * 写时调用
//     * @param value
//     * @param contentProperty
//     * @param globalConfiguration
//     * @return
//     * @throws Exception
//     */
//    @Override
//    public CellData convertToExcelData(Object value, ExcelContentProperty contentProperty,
//                                       GlobalConfiguration globalConfiguration) throws Exception {
//        if (value == null) {
//            return new CellData("");
//        }
//        return new CellData(DateTool.getMinSecond(Double.valueOf(String.valueOf(value)) / 1000));
//    }
}
